home *** CD-ROM | disk | FTP | other *** search
/ Chip 2006 June / CHIP 2006-06.2.iso / program / freeware / Democracy-0.8.2.exe / xulrunner / python / BitTorrent / obsoletepythonsupport.py < prev    next >
Encoding:
Python Source  |  2006-04-10  |  1005 b   |  33 lines

  1. # The contents of this file are subject to the BitTorrent Open Source License
  2. # Version 1.0 (the License).  You may not copy or use this file, in either
  3. # source code or executable form, except in compliance with the License.  You
  4. # may obtain a copy of the License at http://www.bittorrent.com/license/.
  5. #
  6. # Software distributed under the License is distributed on an AS IS basis,
  7. # WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
  8. # for the specific language governing rights and limitations under the
  9. # License.
  10.  
  11. from __future__ import generators
  12.  
  13. import sys
  14. if sys.version_info < (2, 3):
  15.     # Allow int() to create numbers larger than "small ints".
  16.     # This is NOT SAFE if int is used as the name of the type instead
  17.     # (as in "type(x) in (int, long)").
  18.     int = long
  19.  
  20.     def enumerate(x):
  21.         i = 0
  22.         for y in x:
  23.             yield (i, y)
  24.             i += 1
  25.  
  26.     def sum(seq):
  27.         r = 0
  28.         for x in seq:
  29.             r += x
  30.         return r
  31.  
  32. del sys
  33.